{$CLEO .cs}
0000:
        {
0AE2: 18@ = random_vehicle_near_point 0.0 0.0 0.0 in_radius 9999999999.0 find_next 1 pass_wrecked 1
IF is_car_defined 18@
THEN
    IF  OR
    0137:   car 18@ model == #STREAK
    0137:   car 18@ model == #STREAKC
    0137:   car 18@ model == #TRAM
    0137:   car 18@ model == #FREIGHT
    0137:   car 18@ model == #FREIFLAT
    0137:   car 18@ model == #FREIBOX  
    THEN
    terminate_this_custom_script
    END
END               }
 
32@=0
 
  
while true
wait 0 
    if cheat "Train"
    then
        show_text_highpriority "Train reloaded"  3000
     ///   terminate_this_custom_script
       jump @reload
    end
    if   and
    8154: not actor $PLAYER_ACTOR in_zone 'SAN_AND'  // Easter Basin 
    32@ > 30000
    then
         break
    end       
end
animation_load "PLAYIDLES"
model.Load(#STREAK)
model.Load(#STREAKC)
load_requested_models

const
    train_stopped = 10@ 
    random_number  =  28@
    music= 7@
end 
 
 0209: 6@ = random_int_in_ranges 0 17
     music=audiostream.Load3D("cleo\[@railcity]\xxxxx.mp3") 
   
audiostream.Loop(music,1)
train_stopped=0 
:1
wait 0
if and 
model.Available(#STREAK)
model.Available(#STREAKC)
jf @1 
//0208: random_number = random_float_in_ranges -100.2 100.2
0209: random_number = random_int_in_ranges 0 7

actor.StorePos( player1,  29@ ,30@ ,31@)
04C4: store_coords_to 29@ 30@ 31@ from_actor player1 with_offset  100.0   100.0 0.0
if random_number == 0 
then
04C4: store_coords_to 29@ 30@ 31@ from_actor player1 with_offset -100.0  -100.0 0.0
end
if random_number == 1 
then
04C4: store_coords_to 29@ 30@ 31@ from_actor player1 with_offset  100.0 100.0 0.0
end
if random_number == 2
then
04C4: store_coords_to 29@ 30@ 31@ from_actor player1 with_offset  100.0 -100.0 0.0
end
if random_number == 3
then
04C4: store_coords_to 29@ 30@ 31@ from_actor player1 with_offset  -100.0  100.0 0.0
end
if random_number == 4
then
04C4: store_coords_to 29@ 30@ 31@ from_actor player1 with_offset   100.0  0.0 0.0
end
if random_number == 5
then
04C4: store_coords_to 29@ 30@ 31@ from_actor player1 with_offset  100.0  0.0 0.0
end
if random_number == 6
then
04C4: store_coords_to 29@ 30@ 31@ from_actor player1 with_offset  -100.0  0.0 0.0
end

 
06D8: 0@ = create_train_at  29@ 30@ 31@ type 16 direction 1
06DC: set_train 0@ acc 40.0
06DD: set_train 0@ speed 40.0
audiostream.LinkToCar(music,0@)

0209: random_number = random_int_in_ranges 0 2
if  random_number ==0
then

   audiostream.PerformAction(music,PLAY)
end
0209: random_number = random_int_in_ranges 0 2
if  random_number ==0
then
0407: store_coords_to 29@ 30@ 31@  from_car 0@ with_offset  0.0 0.0 0.0

0376: 12@ = create_random_actor_at 29@ 30@ 31@ 
0464: put_actor 12@ into_turret_on_car 0@ at_car_offset 0.0 0.0 0.1 position 1 shooting_angle_limit 0.0 with_weapon 0
ACTOR.Health(12@)=400
07FE: set_actor 12@ fighting_style_to 5 moves 6
0446: set_actor 12@ dismemberment_possible 0
0376: 13@ = create_random_actor_at 29@ 30@ 31@ 
0464: put_actor 13@ into_turret_on_car 0@ at_car_offset 0.0 2.0 0.1 position 1 shooting_angle_limit 90.0 with_weapon 0
ACTOR.Health(13@)=400
07FE: set_actor 13@ fighting_style_to 7 moves 6
0446: set_actor 13@ dismemberment_possible 0
0376: 14@ = create_random_actor_at 29@ 30@ 31@ 
0464: put_actor 14@ into_turret_on_car 0@ at_car_offset 1.0 2.0 0.1 position 1 shooting_angle_limit 90.0 with_weapon 0
ACTOR.Health(14@)=400
07FE: set_actor 14@ fighting_style_to 5 moves 6
0446: set_actor 14@ dismemberment_possible 0
0376: 15@ = create_random_actor_at 29@ 30@ 31@ 
0464: put_actor 15@ into_turret_on_car 0@ at_car_offset 0.1 5.0 0.1 position 1 shooting_angle_limit 90.0 with_weapon 0
ACTOR.Health(15@)=400
07FE: set_actor 15@ fighting_style_to 15 moves 6
0446: set_actor 15@ dismemberment_possible 0
//06B0: AS_actor 15@ sit_down 9999999 ms
0376: 16@ = create_random_actor_at 29@ 30@ 31@ 
0464: put_actor 16@ into_turret_on_car 0@ at_car_offset -0.1 6.0 0.1 position 1 shooting_angle_limit 270.0 with_weapon 0
ACTOR.Health(16@)=400
07FE: set_actor 16@ fighting_style_to 15 moves 6
0446: set_actor 16@ dismemberment_possible 0
//06B0: AS_actor 16@ sit_down 9999999 ms

0605: actor 16@ perform_animation "strleg" IFP "PLAYIDLES" framedelta 4.0 loop 1 lockX 0 lockY 0 lockF 0 time -1
0605: actor 15@ perform_animation "strleg" IFP "PLAYIDLES" framedelta 4.0 loop 1 lockX 0 lockY 0 lockF 0 time -1 
0619: enable_actor 12@ collision_detection 0
0619: enable_actor 13@ collision_detection 0
0619: enable_actor 14@ collision_detection 0
0619: enable_actor 15@ collision_detection 0
0619: enable_actor 16@ collision_detection 0 
end

car.Health( 0@ )=3000

 
 {
0229: set_car 0@ primary_color_to 0 secondary_color_to 0 
078A:  2@ = get_train 0@ carriage 1 handle
if car_defined = 2@
then 0229: set_car 2@ primary_color_to 0 secondary_color_to 0 
end 
078A:  2@ = get_train 0@ carriage 2 handle
if car_defined = 2@
then 0229: set_car 2@ primary_color_to 0 secondary_color_to 0 
end 
078A:  2@ = get_train 0@ carriage 3 handle
if car_defined = 2@
then 0229: set_car 2@ primary_color_to 0 secondary_color_to 0 
end 
078A:  2@ = get_train 0@ carriage 4 handle
if car_defined = 2@
then 0229: set_car 2@ primary_color_to 0 secondary_color_to 0 
end 
078A:  2@ = get_train 0@ carriage 5 handle
if car_defined = 2@
then 0229: set_car 2@ primary_color_to 0 secondary_color_to 0 
end 
078A:  2@ = get_train 0@ carriage 6 handle
if car_defined = 2@
then 0229: set_car 2@ primary_color_to 0 secondary_color_to 0 
end                                                }
//06DE:  2@ = get_train 0@ last_carriage_handle

 1@ = marker.CreateAboveCar(0@)
 marker.SetColor(1@, 4)
 marker.SetIconSize(1@,2)
018B: set_marker 1@ radar_mode 0     
     wait 500
    while   is_car_defined 0@  
    wait 0
    if cheat "Train"
    then
        show_text_highpriority "Train reloaded"  3000
        if is_car_defined 0@
        then
            07BE: remove_references_to_train 0@
           
        end
        gosub   @clear_peds
       jump @reload
    end
    //instant kill by train
    0AE1: 23@ = random_char_near_point 0.0 0.0 0.0 in_radius 999999999999.0 find_next 1 pass_deads 1
    if actor_defined  23@
    then
        if and
        train_stopped == 0
        051B:   actor 23@ damaged_by_car 0@
        then
            0851: set_actor 23@ decrease_health_by 1500000 affect_armour 0 
            054E: clear_actor 23@ damage 
            if 0104:   actor $PLAYER_ACTOR near_actor 23@ radius 10.0 10.0 10.0 sphere 0
            then
               shake_camera 25  
            end
        end
    end

    
        if is_car_defined 0@ 
        then 
           // gosub @PED_STOPS 
                if train_stopped==0
                then
                    if or 
                     01AF:   car 0@ sphere 0 in_sphere  -456.6826 -4437.9531 4.9662 radius 6.3 6.3 3.0
                     01AF:   car 0@ sphere 0 in_sphere -3945.3315 -6119.2861 16.8353  radius 6.3 6.3 3.0
                     01AF:   car 0@ sphere 0 in_sphere -3082.8687 -4006.6772 24.3862  radius 6.3 6.3 3.0
                     01AF:   car 0@ sphere 0 in_sphere -3063.6467 -3997.9824 24.3862  radius 6.3 6.3 3.0
                     01AF:   car 0@ sphere 0 in_sphere -3416.6235 -2364.6602 24.3862  radius 6.3 6.3 3.0
                     01AF:   car 0@ sphere 0 in_sphere -3445.5122 -2396.7639 24.3862  radius 6.3 6.3 3.0
                     01AF:   car 0@ sphere 0 in_sphere  -4446.6768 -1600.9254 24.3928 radius 6.3 6.3 3.0
                     01AF:   car 0@ sphere 0 in_sphere  -3399.9766 -2382.0942 25.3298 radius 6.3 6.3 5.0
                    

                    then
                        train_stopped=1
                        gosub @slow_stop_train 
                    end
                    if or 
                     01AF:   car 0@ sphere 0 in_sphere   -454.9391 -3148.9839 4.4562 radius 6.3 6.3 3.0
                     01AF:   car 0@ sphere 0 in_sphere  -1782.2487 -4751.8213 24.3862 radius 6.3 6.3 3.0
                     01AF:   car 0@ sphere 0 in_sphere -1268.0254 -5437.541 25.3298 radius 6.3 6.3 3.0
                     01AF:   car 0@ sphere 0 in_sphere  -470.0653 -3148.7375 4.4562 radius 6.3 6.3 3.0
     

                     01AF:   car 0@ sphere 0 in_sphere  4640.2954 -3396.4387 21.5684 radius 6.3 6.3 3.0
                     01AF:   car 0@ sphere 0 in_sphere 4431.5571 -1693.0486 3.4384  radius 3.0 3.0 3.0
                     
                      01AF:   car 0@ sphere 0 in_sphere  -765.1942 -3739.9788 24.3862 radius 8.3 8.3 3.0 
                      01AF:   car 0@ sphere 0 in_sphere  -3079.4595 -5623.647 11.2062 radius 8.3 8.3 3.0 
     
                    then
                        train_stopped=1
                        gosub @stop_train 
                    end
                    
                    
                    if  or   
                     01AF:   car 0@ sphere 0 in_sphere -3423.877 -2418.0564 24.3862 radius 6.3 6.3 3.0 
                    
                     01AF:   car 0@ sphere 0 in_sphere   -2995.5388 -6349.6416 10.9013 radius 6.0 6.0 3.0  
                    01AF:   car 0@ sphere 0 in_sphere   -4496.0215 -1601.1866 24.3928 radius 6.0 6.0 3.0  
                    
                    01AF:   car 0@ sphere 0 in_sphere 2801.8108 -6698.2964 18.2562  radius 8.0 8.0 3.0  
                     01AF:   car 0@ sphere 0 in_sphere  2808.2446 -6692.5566 18.2562 radius 8.0 8.0 3.0  
                     01AF:   car 0@ sphere 0 in_sphere  3181.6616 -2279.7356 18.1472 radius 20.0 20.0 4.0  
                     01AF:   car 0@ sphere 0 in_sphere   -3174.9517 -2385.2681 11.4219 radius 6.3 6.3 3.0  

                    then
                        train_stopped=1
                        gosub @slow_stop_train 
                        if car_defined 0@
                        then
                        
                        else
                            gosub @clear_peds_ghost
                            JUMP @cleanup
                        end                        
                    end
                    
                    if  or     
                     
                    
                     01AF:   car 0@ sphere 0 in_sphere   -1431.4318 -5961.1147 15.3662 radius 6.0 6.0 3.0  
                      01AF:   car 0@ sphere 0 in_sphere  784.6857 -6855.6963 32.7762 radius 6.0 6.0 3.0  
                      01AF:   car 0@ sphere 0 in_sphere  286.4396 -4751.2119 24.3862 radius 6.0 6.0 3.0  
                      01AF:   car 0@ sphere 0 in_sphere  -1076.7339 -6953.7607 18.2562 radius 6.0 6.0 3.0 
                      
                      ///NEW 
                      01AF:   car 0@ sphere 0 in_sphere 2756.4446 -5233.8687 4.3114 radius 6.0 6.0 3.0  
                      01AF:   car 0@ sphere 0 in_sphere 2819.0425 -5285.5937 4.3114 radius 6.0 6.0 3.0  
                      01AF:   car 0@ sphere 0 in_sphere 2886.1104 -5940.7778 4.3274 radius 6.0 6.0 3.0  
                      01AF:   car 0@ sphere 0 in_sphere 2886.9753 -5940.1978 4.3274 radius 6.0 6.0 3.0  
                    then
                        train_stopped=1
                        gosub @stop_train 
                        if car_defined 0@
                        then
                        
                        else
                            gosub @clear_peds_ghost
                            JUMP @cleanup
                        end
                    end
                    
                    if  or   
                     01AF:   car 0@ sphere 0 in_sphere  2760.7246 -3844.5891 4.3155   radius 6.3 6.3 3.0 
                     01AF:   car 0@ sphere 0 in_sphere  2716.2358 -3795.1147 4.3155   radius 6.3 6.3 3.0 
                     01AF:   car 0@ sphere 0 in_sphere   -3204.2368 -2371.2368 11.1862 radius 6.3 6.3 3.0 
                     01AF:   car 0@ sphere 0 in_sphere  -3190.8479 -2391.2302 11.1862 radius 6.3 6.3 3.0 
                     01AF:   car 0@ sphere 0 in_sphere  2715.4675 -3803.7253 4.3155 radius 6.3 6.3 3.0 
                     01AF:   car 0@ sphere 0 in_sphere  2716.1064 -3781.6042 4.3155 radius 6.3 6.3 3.0 

                    then
                        train_stopped=1
                        gosub @slow_stop_train 
                        if car_defined 0@
                        then
                        
                        else
                            gosub @clear_peds_ghost
                            JUMP @cleanup
                        end                        
                    end                    
                    if    or   
                    
                     01AF:   car 0@ sphere 0 in_sphere  -1009.7512 -6855.6724 32.7762 radius 6.0 6.0 3.0  
                     01AF:   car 0@ sphere 0 in_sphere  -2654.8879 -4771.0122 24.3862 radius 7.0 7.0 3.0  
                      01AF:   car 0@ sphere 0 in_sphere  -1098.8645 -6953.5693 18.2562 radius 7.0 7.0 3.0  
                      01AF:   car 0@ sphere 0 in_sphere 305.9673 -7992.6069 18.2562  radius 6.0 6.0 3.0  
               //new 
                  01AF:   car 0@ sphere 0 in_sphere  2252.2268 -3376.3093 4.3042 radius 6.0 6.0 3.0  
                  01AF:   car 0@ sphere 0 in_sphere  2219.2075 -3388.1165 4.3042  radius 6.0 6.0 3.0  
                  01AF:   car 0@ sphere 0 in_sphere  -3406.1619 -2307.8972 26.9317 radius 6.0 6.0 3.0  
                  
                  //nEWER 
                    01AF:   car 0@ sphere 0 in_sphere -3231.0317 -4690.751 24.5734 radius 6.3 6.3 3.0 
               
                    then
                        train_stopped=1
                        gosub @stop_train_faster
                        if car_defined 0@
                        then
                        
                        else
                            gosub @clear_peds_ghost
                            JUMP @cleanup
                        end
                    end
                    if or 
                     01AF:   car 0@ sphere 0 in_sphere  723.4862 -3381.8542 26.7348  radius 6.3 6.3 3.0 
                     01AF:   car 0@ sphere 0 in_sphere  -1578.6356 -3042.4028 26.7348  radius 6.3 6.3 3.0 
                    01AF:   car 0@ sphere 0 in_sphere 2231.4939 -3386.8337 5.3298   radius 6.3 6.3 3.0 
                    01AF:   car 0@ sphere 0 in_sphere 2223.498 -3387.425 5.3024 radius 6.3 6.3 3.0 
                    
                    
                    01AF:   car 0@ sphere 0 in_sphere  5233.4424 -7010.1396 4.9662 radius 6.3 6.3 3.0 
                    01AF:   car 0@ sphere 0 in_sphere  6003.3657 -6799.3604 4.9662 radius 6.3 6.3 3.0 
                    01AF:   car 0@ sphere 0 in_sphere   6003.5054 -5526.2031 4.9662 radius 6.3 6.3 3.0 
                    01AF:   car 0@ sphere 0 in_sphere 4570.4839 -4792.7788 5.4548 radius 6.3 6.3 3.0 
                    
                    then
                        train_stopped=1
                        gosub @stop_train 
                    end
                                           
                     

               end    
               
               //speed up 
               if 33@ > 3000
               then
                   if OR
                    00B1:   car 0@ sphere 0 in_cube_cornerA  3153.8225 -5560.7783 8.2562 cornerB  3209.3079 -2662.7769 45.307

                    01AF:   car 0@ sphere 0 in_sphere 3182.3066 -2797.416 22.3869 radius 20.0 20.0 14.0  
                    01AF:   car 0@ sphere 0 in_sphere 3176.9182 -5602.2549 18.2562  radius 20.0 20.0 24.0  
                   then
                    33@=0
                        06DC: set_train 0@ acc 100.0
                        06DD: set_train 0@ speed 100.0    
                                   
                   end
                   if OR
                   
                    01AF:   car 0@ sphere 0 in_sphere  3182.5024 -2619.7935 25.3869 radius 20.0 20.0 14.0  
                    01AF:   car 0@ sphere 0 in_sphere  3179.7415 -5832.9087 18.2562  radius 20.0 20.0 24.0  
                    01AF:   car 0@ sphere 0 in_sphere  3180.2705 -2571.3999 26.8958 radius 20.0 20.0 24.0  
                   then
                    33@=0
                        06DC: set_train 0@ acc 40.0
                        06DD: set_train 0@ speed 40.0    
                                   
                   end
                   
               end
               {
                 or
                  01AF:   car 0@ sphere 0 in_sphere  -1710.9052 -4754.1011 24.3862 radius 2.3 2.3 3.0
                  01AF:   car 0@ sphere 0 in_sphere -393.6799 -3154.7014 4.4562  radius 2.3 2.3 3.0
                  01AF:   car 0@ sphere 0 in_sphere -458.9049 -4494.7681 4.9662  radius 2.3 2.3 3.0
                  01AF:   car 0@ sphere 0 in_sphere  -1282.1602 -5435.0381 24.3862 radius 2.3 2.3 3.0


                  01AF:   car 0@ sphere 0 in_sphere  -1240.9048 -5439.3286 24.3862 radius 2.3 2.3 3.0
                  01AF:   car 0@ sphere 0 in_sphere   radius 2.3 2.3 3.0
                  01AF:   car 0@ sphere 0 in_sphere   radius 2.3 2.3 3.0
                  01AF:   car 0@ sphere 0 in_sphere   radius 2.3 2.3 3.0

                                                                                   }
                 if and
                 train_stopped==1
                  32@ >= 10000
                 then
                    train_stopped=0
                    wait 200
                    if  is_car_defined 0@
                    jf @error 
                    06DC: set_train 0@ acc 10.0
                    06DD: set_train 0@ speed 10.0
                    wait 200
                    if  is_car_defined 0@
                    jf @error 
                    06DC: set_train 0@ acc 15.0
                    06DD: set_train 0@ speed 15.0
                    wait 200
                    if  is_car_defined 0@
                    jf @error 
                    06DC: set_train 0@ acc 20.0
                    06DD: set_train 0@ speed 20.0
                    wait 200
                    if  is_car_defined 0@
                    jf @error 
                    06DC: set_train 0@ acc 25.0
                    06DD: set_train 0@ speed 25.0
                    wait 200
                    if  is_car_defined 0@
                    jf @error 
                    06DC: set_train 0@ acc 30.0
                    06DD: set_train 0@ speed 30.0
                    wait 200
                    if  is_car_defined 0@
                    jf @error 
                    06DC: set_train 0@ acc 40.0
                    06DD: set_train 0@ speed 40.0
                    32@ = 0 
                    
                 end  
        end
        19@=car.Health(0@ )
        if 19@ <=0
        then
            train_stopped=0
            06DC: set_train 0@ acc 0.0
            06DD: set_train 0@ speed 0.0   
           081D: set_car 0@ engine_broken 1
           0918: set_car 0@ engine_operation 0

           gosub @clear_peds_ghost
              0325: 20@ = create_car 0@ fire  
           if is_car_defined 0@
           then

                06DC: set_train 0@ acc 0.0
                06DD: set_train 0@ speed 0.0

              07BE: remove_references_to_train 0@

           end                  
            model.Destroy(#STREAK)
            model.Destroy(#STREAKC)    
            
           REPEAT 
           WAIT 0           
                if cheat "Train"
                then
                    show_text_highpriority "Train reloaded"  3000
                    if is_car_defined 0@
                    then
                        07BE: remove_references_to_train 0@
                       
                    end
                    gosub   @clear_peds
                   jump @reload
                end           
           UNTIL  8205:   not actor $PLAYER_ACTOR near_car 0@ radius 170.0 170.0 170.0 flag 0        
           07BE: remove_references_to_train 0@
           JUMP @cleanup     
        end        
        if 8205:   not actor $PLAYER_ACTOR near_car 0@ radius 170.0 170.0 170.0 flag 0

        then
            //   show_text_box "Train will now disappear..."
           gosub @Clear_peds
        
           if is_car_defined 0@
           then
    
                06DC: set_train 0@ acc 40.0
                06DD: set_train 0@ speed 40.0
                

              07BE: remove_references_to_train 0@
             
           end
            :alt
            model.Destroy(#STREAK)
            model.Destroy(#STREAKC)      
            Audiostream.Release(music)
            
           jump @cleanup
        end 
    end
    
    :error 
    model.Destroy(#STREAK)
    model.Destroy(#STREAKC)

   if is_car_defined 0@
   then
                    06DC: set_train 0@ acc 40.0
                    06DD: set_train 0@ speed 40.0
      gosub @Clear_peds
 
      07BE: remove_references_to_train 0@

   end   
   

:cleanup
  :reload
Audiostream.Release(music)
stream_custom_script "!! @ Train Railcity.cs"        
terminate_this_custom_script 
 
:stop_train_faster
9@=1
    wait 50
    if  is_car_defined 0@
    return_if_false
    06DC: set_train 0@ acc 40.0
    06DD: set_train 0@ speed 40.0
    wait 50
    if  is_car_defined 0@
    return_if_false
    06DC: set_train 0@ acc 40.0
    06DD: set_train 0@ speed 40.0
    
    wait 50
    if  is_car_defined 0@
    return_if_false
    06DC: set_train 0@ acc 30.0
    06DD: set_train 0@ speed 30.0
    wait 50
    if  is_car_defined 0@
    return_if_false
    06DC: set_train 0@ acc 20.0
    06DD: set_train 0@ speed 20.0
    wait 50
    if  is_car_defined 0@
    return_if_false
    06DC: set_train 0@ acc 10.0
    06DD: set_train 0@ speed 10.0
    wait 50
    if  is_car_defined 0@
    return_if_false
    06DC: set_train 0@ acc 0.0
    06DD: set_train 0@ speed 0.0
    32@=0 
 
return  

:stop_train
9@=0
    wait 200
    if  is_car_defined 0@
    return_if_false
    06DC: set_train 0@ acc 40.0
    06DD: set_train 0@ speed 40.0
    wait 200
    if  is_car_defined 0@
    return_if_false
    06DC: set_train 0@ acc 40.0
    06DD: set_train 0@ speed 40.0
    
    wait 200
    if  is_car_defined 0@
    return_if_false
    06DC: set_train 0@ acc 30.0
    06DD: set_train 0@ speed 30.0
    wait 200
    if  is_car_defined 0@
    return_if_false
    06DC: set_train 0@ acc 20.0
    06DD: set_train 0@ speed 20.0
    wait 200
    if  is_car_defined 0@
    return_if_false
    06DC: set_train 0@ acc 10.0
    06DD: set_train 0@ speed 10.0
    wait 200
    if  is_car_defined 0@
    return_if_false
    06DC: set_train 0@ acc 0.0
    06DD: set_train 0@ speed 0.0
    32@=0 
 
return  
:slow_stop_train
9@=-1
    wait 500
    if  is_car_defined 0@
    return_if_false
    06DC: set_train 0@ acc 40.0
    06DD: set_train 0@ speed 40.0
    wait 500
    if  is_car_defined 0@
    return_if_false
    06DC: set_train 0@ acc 40.0
    06DD: set_train 0@ speed 40.0
    
    wait 500
    if  is_car_defined 0@
    return_if_false
    06DC: set_train 0@ acc 30.0
    06DD: set_train 0@ speed 30.0
    wait 500
    if  is_car_defined 0@
    return_if_false
    06DC: set_train 0@ acc 20.0
    06DD: set_train 0@ speed 20.0
    wait 500
    if  is_car_defined 0@
    return_if_false
    06DC: set_train 0@ acc 10.0
    06DD: set_train 0@ speed 10.0
    wait 500
    if  is_car_defined 0@
    return_if_false
    06DC: set_train 0@ acc 0.0
    06DD: set_train 0@ speed 0.0
    32@=0 
    
return  
        
:clear_peds_ghost
                if is_actor_defined 12@
                then 0465: remove_actor 12@ turret_mode
                end 
                if is_actor_defined 13@
                then 0465: remove_actor 13@ turret_mode
                end 
                if is_actor_defined 14@
                then 0465: remove_actor 14@ turret_mode
                end 
                if is_actor_defined 15@
                then 0465: remove_actor 15@ turret_mode
                end 
                if is_actor_defined 16@
                then 0465: remove_actor 16@ turret_mode
                end 
 
                if is_actor_defined 12@
                then 0619: enable_actor 12@ collision_detection 1
                end 
                if is_actor_defined 13@
                then 0619: enable_actor 13@ collision_detection 1
                end 
                if is_actor_defined 14@
                then 0619: enable_actor 14@ collision_detection 1
                end 
                if is_actor_defined 15@
                then 0619: enable_actor 15@ collision_detection 1
                end 
                if is_actor_defined 16@
                then 0619: enable_actor 16@ collision_detection 1
                end 
 

            if is_actor_defined 12@
            then ACTOR.RemoveReferences(12@)
            end 
            if is_actor_defined 13@
            then ACTOR.RemoveReferences(13@)
            end 
            if is_actor_defined 14@
            then ACTOR.RemoveReferences(14@)
            end 
            if is_actor_defined 15@
            then ACTOR.RemoveReferences(15@)
            end 
            if is_actor_defined 16@
            then ACTOR.RemoveReferences(16@)
            end 
            animation_release "PLAYIDLES"
return 
 
 :clear_peds
if is_actor_defined 12@
then ACTOR.DestroyInstantly(12@)
end 
if is_actor_defined 13@
then ACTOR.DestroyInstantly(13@)
end 
if is_actor_defined 14@
then ACTOR.DestroyInstantly(14@)
end 
if is_actor_defined 15@
then ACTOR.DestroyInstantly(15@)
end 
if is_actor_defined 16@
then ACTOR.DestroyInstantly(16@)
end 
 
animation_release "PLAYIDLES"
 return 
   